/* admin.js 
 * liangbo@me.com
 * */

function createduser(obj){
	$.ajax({
		type: 'POST',
		url: 'user',
		data: {'_xsrf':$.cookie('_xsrf'),'action':'create','data':obj},
		dataType:'json',
		success: function(resp,status,result){
			if(resp.result == 'saved'){
				//$("#domainform").dialog('close');
				//open('domain');
				alert('success');				
			}else{
				alert('failed');
			}
		},
		error: function(resp,status,err){
			alert(err+"_"+status+"_"+resp);
			//console.log(err);
		}
	});
}

$(document).ready(function(){
	$('#btEnter').click(function(){
		//alert($('#username')+"_"+$('#userpass'));
		var obj = {username:$('#username').val(),userpass:$('#userpass').val()};
		alert(obj.username);
		createduser(obj);
		return false;
	});
});
